{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Speed difference between reading numerical data from plain CSV vs. using _.npy_ file format\n",
    "### Dr. Tirthajyoti Sarkar, Fremont, CA 94536"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import time"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Number of samples"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "n_samples=1000000"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Reading from a CSV"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "with open('fdata.txt', 'w') as fdata:\n",
    "    for _ in range(n_samples):\n",
    "        fdata.write(str(10*np.random.random())+',')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[0.19518972 6.39889099 8.86179077 ... 1.78274828 4.14988379 7.45517339]\n",
      " [0.28846542 6.64861961 0.24638384 ... 1.30792505 1.0367481  4.74891783]\n",
      " [8.40814537 5.05111512 8.63130373 ... 6.54190772 6.38385259 2.75347884]\n",
      " ...\n",
      " [5.05132432 5.93558368 9.07536994 ... 3.65136772 6.29371461 3.87511569]\n",
      " [7.44320641 3.3288574  0.27708193 ... 2.10070278 6.34682483 9.01881409]\n",
      " [1.52621504 9.35146825 1.50775586 ... 2.60806502 5.0169436  4.3254457 ]]\n",
      "\n",
      "Shape:  (1000, 1000)\n",
      "Time took to read: 1.695016860961914 seconds.\n"
     ]
    }
   ],
   "source": [
    "t1=time.time()\n",
    "array_direct = np.fromfile('fdata.txt',dtype=float, count=-1,sep=',').reshape(1000,1000)\n",
    "t2=time.time()\n",
    "print(array_direct)\n",
    "print('\\nShape: ',array_direct.shape)\n",
    "print(f\"Time took to read: {t2-t1} seconds.\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[0.19518972 6.39889099 8.86179077 ... 1.78274828 4.14988379 7.45517339]\n",
      " [0.28846542 6.64861961 0.24638384 ... 1.30792505 1.0367481  4.74891783]\n",
      " [8.40814537 5.05111512 8.63130373 ... 6.54190772 6.38385259 2.75347884]\n",
      " ...\n",
      " [5.05132432 5.93558368 9.07536994 ... 3.65136772 6.29371461 3.87511569]\n",
      " [7.44320641 3.3288574  0.27708193 ... 2.10070278 6.34682483 9.01881409]\n",
      " [1.52621504 9.35146825 1.50775586 ... 2.60806502 5.0169436  4.3254457 ]]\n",
      "\n",
      "Shape:  (1000, 1000)\n",
      "Time took to read: 0.5665757656097412 seconds.\n"
     ]
    }
   ],
   "source": [
    "t1=time.time()\n",
    "with open('fdata.txt','r') as fdata:\n",
    "    datastr=fdata.read()\n",
    "lst = datastr.split(',')\n",
    "lst.pop()\n",
    "array_lst=np.array(lst,dtype=float).reshape(1000,1000)\n",
    "t2=time.time()\n",
    "print(array_lst)\n",
    "print('\\nShape: ',array_lst.shape)\n",
    "print(f\"Time took to read: {t2-t1} seconds.\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Save as a .npy file and read"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "np.save('fnumpy.npy',array_lst)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[0.19518972 6.39889099 8.86179077 ... 1.78274828 4.14988379 7.45517339]\n",
      " [0.28846542 6.64861961 0.24638384 ... 1.30792505 1.0367481  4.74891783]\n",
      " [8.40814537 5.05111512 8.63130373 ... 6.54190772 6.38385259 2.75347884]\n",
      " ...\n",
      " [5.05132432 5.93558368 9.07536994 ... 3.65136772 6.29371461 3.87511569]\n",
      " [7.44320641 3.3288574  0.27708193 ... 2.10070278 6.34682483 9.01881409]\n",
      " [1.52621504 9.35146825 1.50775586 ... 2.60806502 5.0169436  4.3254457 ]]\n",
      "\n",
      "Shape:  (1000, 1000)\n",
      "Time took to load: 0.00496673583984375 seconds.\n"
     ]
    }
   ],
   "source": [
    "t1=time.time()\n",
    "array_reloaded = np.load('fnumpy.npy')\n",
    "t2=time.time()\n",
    "print(array_reloaded)\n",
    "print('\\nShape: ',array_reloaded.shape)\n",
    "print(f\"Time took to load: {t2-t1} seconds.\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[0.19518972 6.39889099 8.86179077 ... 9.63106665 1.85069765 4.25534529]\n",
      " [8.14357747 6.56347765 8.02998847 ... 0.93040803 6.67272555 6.91109852]\n",
      " [1.51447298 4.95842653 5.70978086 ... 7.32853786 4.5788133  3.44281139]\n",
      " ...\n",
      " [2.35366938 9.77452941 6.17511558 ... 9.61026204 2.85523678 1.55581879]\n",
      " [2.97670426 8.5953027  8.24646196 ... 0.62146363 5.68336225 8.85861478]\n",
      " [1.29283608 0.21021618 4.93077805 ... 2.60806502 5.0169436  4.3254457 ]]\n",
      "\n",
      "Shape:  (10000, 100)\n",
      "Time took to load: 0.006982326507568359 seconds.\n"
     ]
    }
   ],
   "source": [
    "t1=time.time()\n",
    "array_reloaded = np.load('fnumpy.npy').reshape(10000,100)\n",
    "t2=time.time()\n",
    "print(array_reloaded)\n",
    "print('\\nShape: ',array_reloaded.shape)\n",
    "print(f\"Time took to load: {t2-t1} seconds.\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Speed enhancement as the sample size grows..."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Array shape: (100000,)\n",
      "Array shape: (100000,)\n",
      "Processing done for 100000 samples\n",
      "\n",
      "Array shape: (200000,)\n",
      "Array shape: (200000,)\n",
      "Processing done for 200000 samples\n",
      "\n",
      "Array shape: (300000,)\n",
      "Array shape: (300000,)\n",
      "Processing done for 300000 samples\n",
      "\n",
      "Array shape: (400000,)\n",
      "Array shape: (400000,)\n",
      "Processing done for 400000 samples\n",
      "\n",
      "Array shape: (500000,)\n",
      "Array shape: (500000,)\n",
      "Processing done for 500000 samples\n",
      "\n",
      "Array shape: (600000,)\n",
      "Array shape: (600000,)\n",
      "Processing done for 600000 samples\n",
      "\n",
      "Array shape: (700000,)\n",
      "Array shape: (700000,)\n",
      "Processing done for 700000 samples\n",
      "\n",
      "Array shape: (800000,)\n",
      "Array shape: (800000,)\n",
      "Processing done for 800000 samples\n",
      "\n",
      "Array shape: (900000,)\n",
      "Array shape: (900000,)\n",
      "Processing done for 900000 samples\n",
      "\n",
      "Array shape: (1000000,)\n",
      "Array shape: (1000000,)\n",
      "Processing done for 1000000 samples\n",
      "\n"
     ]
    }
   ],
   "source": [
    "n_samples=[100000*i for i in range(1,11)] \n",
    "time_lst_read=[]\n",
    "time_npy_read=[]\n",
    "\n",
    "for sample_size in n_samples:\n",
    "    with open('fdata.txt', 'w') as fdata:\n",
    "        for _ in range(sample_size):\n",
    "            fdata.write(str(10*np.random.random())+',')\n",
    "\n",
    "    t1=time.time()\n",
    "    with open('fdata.txt','r') as fdata:\n",
    "        datastr=fdata.read()\n",
    "    lst = datastr.split(',')\n",
    "    lst.pop()\n",
    "    array_lst=np.array(lst,dtype=float)\n",
    "    t2=time.time()\n",
    "    time_lst_read.append(1000*(t2-t1))\n",
    "    print(\"Array shape:\",array_lst.shape)\n",
    "\n",
    "    np.save('fnumpy.npy',array_lst)\n",
    "\n",
    "    t1=time.time()\n",
    "    array_reloaded = np.load('fnumpy.npy')\n",
    "    t2=time.time()\n",
    "    time_npy_read.append(1000*(t2-t1))\n",
    "    print(\"Array shape:\",array_reloaded.shape)\n",
    "    \n",
    "    print(f\"Processing done for {sample_size} samples\\n\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAeYAAAEvCAYAAACQdGKzAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nO3de3wV9Z3/8dfXEDVaNYpoIVjRXZoqJBK5CGoVRA1eqkjFequ4Fdlt9eG1qNT1Uh/brTZuVR5127W1al26iJai1dq0Xqja9QJsEKgSBWtrEpVLDZUa/YXw/f1xJjFAIAkkZM7h9Xw8zuOc+cycmc+ZTn0zl8yEGCOSJCkddurpBiRJ0qcMZkmSUsRgliQpRQxmSZJSxGCWJClFDGZJklKkV083ALDvvvvGAQMG9HQbkiRtFwsWLFgVY+zT1rhUBPOAAQOYP39+T7chSdJ2EUL48+bGeShbkqQUMZglSUoRg1mSpBRJxTnmtjQ2NlJTU8PHH3/c060oy+26667079+f/Pz8nm5FktqV2mCuqalhjz32YMCAAYQQerodZakYI6tXr6ampoaDDjqop9uRpHal9lD2xx9/TO/evQ1lbZMQAr179/bIi6SskdpgBgxldQm3I0nZJNXB3NNCCFx99dUtw7fffjs333zzdu3hwgsv5JFHHun25YwePbrNvyV//vnnGTRoEEOGDKGhoaFbe3jllVc45phjKC4u5gtf+AKTJ0/mo48+4v333+fUU0/lsMMO49BDD+Xkk08G4KCDDqK6unqDeVxxxRV873vf69Y+JeW2OVW1HHXrMxx03RMcdeszzKmq3a7LN5i3YJdddmH27NmsWrVqq76/bt26Lu5o+y9nxowZfPOb32Thw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lvv/02AM8++yxHHHEEJSUlPPPMM/zxj39st7fWh2yfeuopLr30UoYMGcJpp53G3/72Nz788EPWrFnDxIkTGTx4MFdeeWXLfJ977jnOP/98IBNwzXuh7RkxYkTLnx298MILnHHGGey+++585jOfYcKECTz//PNA5vxvSUkJO+20E4MGDWLs2LGEEDb4zR1VXl7OW2+9xcUXX8zSpUspKytj5cqVwKd7zevWrePRRx9l4sSJnZq3JLXWr7CgU/XukBPB3N3/wrniiiu49957+fvf/77ZaVpf+bv77rtvMG6XXXYBYKeddiI/P79l2p122ol169bx8ccf841vfINHHnmExYsXc/HFF3foz3taL2f9+vW8+OKLLFy4kIULF1JbW8see+zBDTfcwJgxY1iyZAm/+tWvNpjv1lyt3HqZWzrc3vybIfM7W6+Dts6JDxo0qM299mb77LMP5557Lg8++CDDhw/nueeeAzLBPGvWLJ566ilKS0vZb7/9Ov2bJKnZ1PJiCvLzNqgV5Ocxtbx4u/WQE8Hc3f/C2WeffTjrrLO49957W2pHHnlky/nNGTNmcPTRR2/1/JvDct9992Xt2rVbdRX2iSeeyA9+8IOW4YULFwKwZs0aioqKALj//vtbxh9zzDEth6eXLFnCokWLOr3MY445hjlz5vDRRx/x97//nV/+8pd88Ytf7PR8IHMo/4EHHuDll19uqf33f/837733Hs888wwfffQRAB9++CHLly/nc5/7HAD/8A//QO/evbnuuus8jC1pm40vK+K7E0ooKiwgAEWFBXx3Qgnjy4q2Ww85Eczb4184V1999QZXZ0+fPp377ruP0tJSHnzwQe66666tnndhYSEXX3wxJSUljB8/nuHDh3d6HtOnT2f+/PmUlpZy6KGH8qMf/QiAa665hmnTpnHUUUdtcCX117/+ddauXUtpaSnf+973GDFiRKeXefjhh3PhhRcyYsQIjjjiCCZPnkxZWVmn5wOw//77M3PmTL75zW9SXFzMIYccwvPPP8+ee+7JggULGDZsGKWlpYwaNYrJkydvsI7OOeccli5dyhlnnLFVy5ak1saXFfGH647jT7eewh+uO267hjJAaO/q3+1h2LBhceO/oX399dc55JBDOjyP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0OmXnrWVs+2oaGBIUOG8PbbbzN06FBOOOEEAH7729/y29/+tuW+0GvXruXNN9/kmGOOYfr06fzyl78E4J133uHNN9/kvffeY/To0fTp0wfIPK7xjTfe6FAPzY92XLNmDfX19Rx77LFA5tB660ccNh8mLikpYdCgQfTt2xeAgw8+mHfeeYfevXtvcTkTJkwAYOjQoRs8lvGEE05o+e6ECRN44YUXuOKKK+jduzdVVVW8//77lJWVtTv/tqxdu5b//d//3eB3fPLJJ52ejyTlktwI5jU1nat3UPM55jVr1nDqqady9913c9lllxFjZNq0afzzP//zBtPPnTuXp556ihdffJHddtuN0aNHtzw5amsesQibPkJyc1o/VnHjRy629ZjFzX0/Ly9vg+k37rt5ePLkydx///289957fO1rX+tQjxtbv349hYWFbZ5Tl6QdVW6cY96rf+fqnZ39Xnsxffp0br/9dhobGykvL+enP/0pa9euBaC2tpYVK1awZs0a9t57b3bbbTeWLl3KSy+9BMARRxzB3LlzWb16NY2NjTz88MNb1cPee+/dcv73wQcfbNl77k6/+93v+Otf/0pDQwNz5szhqKOOAuCMM87gN7/5DfPmzaO8vHyr5r3nnnty0EEHtayPGCOvvvpql/UuSdkoN4J57I2Qv9Gzl/MLMvUuUlZWxmGHHcbMmTM58cQTOffccxk1ahQlJSWceeaZfPjhh4wbN45169ZRWlrKDTfcwMiRIwHo27cvN998M6NGjeL444/n8MMP36oeHnjgAaZOnUppaSkLFy7kxhu3/vdNnjyZjZ/o1Zajjz6ar371qwwZMoQvf/nLDBuWeRjKzjvvzJgxYzjrrLO26WrxGTNmcO+993LYYYcxaNAgHn300a2elyTlgpx57COLZmXOKa+pyewpj71xm84vK3NV9vz58/nBD36wybj169dz+OGH8/DDDzNw4MAe6K5zfOyjpDTZIR77SOlZBvF28tprr3HqqadyxhlnZEUoS1I26VAwhxDeBj4EmoB1McZhIYR9gIeAAcDbwFkxxg9C5uqgu4CTgY+AC2OM/9f1rau7XXjhhVx44YWb1A899FDeeuut7d+QJO0AOnOOeUyMcUirXe/rgKd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Sy5v+DNqtJaluq17RRZwvLyDV3AtcA65Ph3kB9jHFdMtx6nbSsx2T8mmT6zq73LS0j1xwMrATuC5nTBT8JIeyO23CXiTHWArcDfwHeJbNdLsDtuDv05Ha7uXm1y2DuBiGEzwC/AK6IMf5tS5O2UYtbUd8hhBBOBVbEGBe0LrcxaWxnnOt983qRORz4wxhjGfB3MofnNsd12UnJOcjTyRx+7gfsDpzUxqRux91ne6y7rV7fBnMXCyHkkwnlGTHG2Un5/RBC32R8X2BFUq8BDmj19f5AXTv1/m3Ut7SMXHIUcFoI4W1gJpnD2XcChSGEXsk0rddJy3pMxu8F/JXOr/dVW1hGrqkBamKMLyfDj5AJarfhrnM88KcY48oYYyMwGzgSt+Pu0JPb7ebm1S6DuQslV+ndC7weY/x+q1GPAc1X900ic+65uX5BcvXeSGBNciikEjgxhLB38q/rE8mcC3oX+DCEMDJZ1gUbzautZeSMGOO0GGP/GOMAMhfBPBNjPA94FjgzmWzj9du8Ts5Mpo9J/ezkateDgIFkLuyYBwxMrlzdOVnGY8l3NreMnBJjfA94J4RQnJTGAq/hNtyV/gKMDCHslqyD5nXsdtz1enK73dwy2tfTJ+tz6QUcTeZQxSJgYfI6mcy5naeBN5P3fZLpA3A3mSsoFwPDWs3ra8Cy5PVPrerDgCXJd37ApzeJaXMZufoCRvPpVdkHk/kP0jLgYWCXpL5rMrwsGX9wq+9fn6zDapKrK5P6yWSupl8OXN+q3uYycvEFDAHmJ9vxHDJXp7oNd+06/jawNFkPD5K5strteNvW6f+QOWffSGZv9aKe3G63tIz2Xt75S5KkFPFQtiRJKWIwS5KUIgazJEkpYjBLkpQiBrMkSSliMEuSlCIGsyRJKWIwS5KUIv8fT3b0jv6421oAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 576x360 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.figure(figsize=(8,5))\n",
    "#plt.xscale('log')\n",
    "#plt.yscale('log')\n",
    "plt.scatter(n_samples,time_lst_read)\n",
    "plt.scatter(n_samples,time_npy_read)\n",
    "plt.legend(['Normal read from CSV','Read from .npy file'])\n",
    "plt.show()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  },
  "latex_envs": {
   "LaTeX_envs_menu_present": true,
   "autoclose": false,
   "autocomplete": true,
   "bibliofile": "biblio.bib",
   "cite_by": "apalike",
   "current_citInitial": 1,
   "eqLabelWithNumbers": true,
   "eqNumInitial": 1,
   "hotkeys": {
    "equation": "Ctrl-E",
    "itemize": "Ctrl-I"
   },
   "labels_anchors": false,
   "latex_user_defs": false,
   "report_style_numbering": false,
   "user_envs_cfg": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
